#pragma once

#ifndef NodeTable_h
#define NodeTable_h

#include <vector>
#include <map>
#include "Type.h"
#include "TreeNode.h"

class NodeTable{

private:
	typedef std::map<Type::Index::Line, TreeNode*> NodeTableType;
	typedef std::map<TreeNode*, Type::Index::Line> LineTableType;

	NodeTableType nodeTable;
	LineTableType lineTable;

public:
	NodeTable(void);
	~NodeTable(void);
	void clear();

	/// insert reference of node with the given line, returns status of operation
	bool insertNode(Type::Index::Line, TreeNode*);

	/// get node with the given line
	TreeNode* getNodeByLine(Type::Index::Line);

	/// get the list of lines associated with the given reference of node
	Type::Index::Line getLineByNode(TreeNode*);

	/// check for exsistence of the given node
	bool isNodeExistInLine(TreeNode*);
	/// check for exsistence of the given line
	bool isLineExistInNode(Type::Index::Line);
};
#endif
